package com.songlanyun.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.songlanyun.common.drive.IntegerEnum;

import java.util.Objects;

/**
 * 宣传素材的相关枚举
 */
public class ApplyNetRedConstant {


    /**
     * 审核状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum StateEnum implements IntegerEnum<Integer>
    {
        //状态 0=待审核 1=通过 2=不通过
        WAIT(0, "待审核"),
        PASS(1,"通过"),
        FAIL(2,"不通过"),
        ;


        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        StateEnum(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static StateEnum getByCode(int code) {
            for (StateEnum value : StateEnum.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }

    /**
     * 粉丝量级
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum FanweightEnum implements IntegerEnum<Integer>
    {
        //状态 0=小于5千 1=小于5万 2=小于20万 3=小于50万 4=小于100万 5=大于100万
        FIVE_THOUSAND(0, "小于5千"),
        FIFTY_THOUSAND(1,"小于5万"),
        TWO_HUNDRED_THOUSAND(2,"小于20万"),
        FIVE_HUNDRED_THOUSAND(3,"小于50万"),
        ONE_MILLION(4,"小于100万"),
        MORE_ONE_MILLION(5,"大于100万"),
        ;


        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        FanweightEnum(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static FanweightEnum getByCode(int code) {
            for (FanweightEnum value : FanweightEnum.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }
}
